<?php

namespace app\models\Child;

use Yii;

/**
 * This is the model class for table "init_grade_user".
 *
 * @property integer $grade_id
 * @property string $grade_name
 * @property string $grade_img
 * @property integer $grade_start_score
 * @property integer $grade_end_score
 * @property integer $grade_number
 * @property string $create_time
 *
 * @property TUserInfo[] $tUserInfos
 */
class InitGradeUser extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'init_grade_user';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['grade_start_score', 'grade_end_score', 'grade_number'], 'integer'],
            [['create_time'], 'safe'],
            [['grade_name'], 'string', 'max' => 50],
            [['grade_img'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'grade_id' => 'Grade ID',
            'grade_name' => 'Grade Name',
            'grade_img' => 'Grade Img',
            'grade_start_score' => 'Grade Start Score',
            'grade_end_score' => 'Grade End Score',
            'grade_number' => 'Grade Number',
            'create_time' => 'Create Time',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTUserInfos()
    {
        return $this->hasMany(TUserInfo::className(), ['user_level' => 'grade_id']);
    }
}
